<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // .任意字符
        var pattren=/g..gle/;
        var str="g  gle";
        console.log(pattren.test(str));
        // .*任意字符串,任意次数
        var pattren=/g.*gle/;
        var str="g         gle";
        console.log(pattren.test(str));
        // []取值范围   一个[]表示一个占位
        var pattren=/g[a-z]*gle/;
        var str="gooooogle";
        console.log(pattren.test(str));
        // [^a-z]    []里的^表示取反
        var pattren=/g[^a-z]*gle/;
        var str="g      gle";
        console.log(pattren.test(str));
        // []+ 至少一次
        var pattren=/g[a-z]+gle/;
        var str="goooooooogle";
        console.log(pattren.test(str));
        // []?  0次或1次
        var pattren=/g[0-9]?gle/;
        var str="g4gle";
        console.log(pattren.test(str));



        // ^开始位置    $结束位置    {n}固定次数
        var reg=/^[a-z]{4}$/;
        var str="gvfb";
        console.log(reg.test(str));
        // {n,}至少n次,至多不限
        var reg=/^[a-z]{4,}$/;
        var str="gvfsdvdvgfnbxfbxdhbb";
        console.log(reg.test(str));
        // {n,m}至少n次,至多m次
        var reg=/^[a-z]{4,8}$/;
        var str="gvfdbhgngfb";
        console.log(reg.test(str));
    </script>
</body>
</html>